package com.snow.useviewdemo.function.navigation;

import android.os.Bundle;

import com.snow.useviewdemo.R;
import com.snow.useviewdemo.base.BaseActivity;
import com.snow.useviewdemo.databinding.ActivityNavigationBarBinding;

import me.majiajie.pagerbottomtabstrip.NavigationController;
import me.majiajie.pagerbottomtabstrip.listener.OnTabItemSelectedListener;

/**
 * Created by zhaoyingtao
 * Date: 2020/6/18
 * Describe:导航栏效果
 */
public class NavigationBarActivity extends BaseActivity<ActivityNavigationBarBinding> {
    @Override
    protected int getLayoutId() {
        return R.layout.activity_navigation_bar;
    }

    @Override
    protected void setViewData(Bundle savedInstanceState) {
        setViewPager();
        setNavTab();
        initListener();
        //关联viewpager和PageNavigationView，不能关联viewpager2
//        navigationController.setupWithViewPager(mBinding.viewpager2);
    }

    private void initListener() {
        navigationController.addTabItemSelectedListener(new OnTabItemSelectedListener() {
            @Override
            public void onSelected(int index, int old) {
                //选中时触发
            }

            @Override
            public void onRepeat(int index) {
                //重复选中时触发
            }
        });
    }

    NavigationController navigationController;

    private void setViewPager() {

    }

    private void setNavTab() {
        navigationController = mBinding.tabNavigationView.material()
                .addItem(android.R.drawable.ic_menu_camera, "相机")
                .addItem(android.R.drawable.ic_menu_compass, "位置")
                .addItem(android.R.drawable.ic_menu_search, "搜索")
                .addItem(android.R.drawable.ic_menu_help, "帮助")
                .build();
    }
}
